public class Segment {

	
	Point a, b;
	String name;
	
	public Segment(Point a, Point b, String name) {
		this.a = a;
		this.b = b;
		this.name = name;
	}
	
	public Point getA() {
		return a;
	}

	public void setA(Point a) {
		this.a = a;
	}

	public Point getB() {
		return b;
	}

	public void setB(Point b) {
		this.b = b;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}


	@Override
	public String toString() {
		return "Segment from " + a.toString() + " to " + b.toString();
	}
	
	public static Object deserialize(String s)
	{java.util.StringTokenizer objectString = new java.util.StringTokenizer(s, ";");
	objectString.nextToken();
	String field = "";
	java.util.StringTokenizer fieldString = null;
	field = objectString.nextToken();
	fieldString = new java.util.StringTokenizer(field, ":");
	Dispatcher dispatcher = new Dispatcher();Point _a= (Point)dispatcher.type(field);
	field = objectString.nextToken();
	fieldString = new java.util.StringTokenizer(field, ":");
	Point _b= (Point)dispatcher.type(field);
	field = objectString.nextToken();
	fieldString = new java.util.StringTokenizer(field, ":");
	fieldString.nextToken();
	fieldString.nextToken();
	String _name= fieldString.nextToken();
	return new Segment(_a,_b,_name);
	}
}